package com.foreknow.springboot_demo.controller;

import com.foreknow.springboot_demo.po.User;
import com.foreknow.springboot_demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping("/UserController")
public class UserController {

    @Autowired
    private UserService userService;


    @RequestMapping("/getUserByIdByPass")
    public User getUserByIdByPass(User user){
        return userService.getUserByIdByPass(user.getUserId(),user.getPassword());
    }

    @RequestMapping("/getUserById")
    public Integer getUserById(User user){
        return  userService.getUserById(user.getUserId());
    }

    @RequestMapping("/saveUser")
    public Integer saveUser(User user){
        return userService.saveUser(user.getUserId(),user.getPassword(),user.getUserName(),user.getUserSex());
    }

}
